/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component,Fragment} from 'react';
import { Form, Button, Badge, Select, DatePicker, Radio, Descriptions, Input, Upload, Icon, TreeSelect } from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';

const { TextArea } = Input;
const { Option } = Select;
const TreeNode = TreeSelect.TreeNode;

const ButtonGroup = Button.Group;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      all_staffs:[],
      all_organizations:[],
      format:'YYYY-MM-DD'
    };
  }
  componentDidMount() {
  }
  render() {
    const {getFieldDecorator} = this.props.form;
    let text ='';
    const editRecord=this.props.editRecord
    if(editRecord.type===1){
      text= '转为积极分子'
    }else if(editRecord.type===2){
      text=  '转为发展对象'
    }else if(editRecord.type===3){
      text=  '转为预备党员'
    }else if(editRecord.type===4){
      text=  '转为正式党员'
    }
    return (
      <div>
        <Form>
          <Descriptions column={2} className={'blue-descriptions'} title={<div style={{textAlign:'center',marginTop:'10px'}}>
            {text}
          </div>} bordered>
            {
              (this.props.editRecord&&this.props.editRecord.type===1)&&
              <Fragment>
                <Descriptions.Item label="确定为入党积极分子时间" span={1}>
                  {getFieldDecorator('determine_activists_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.determine_activists_time?
                      moment(this.props.editRecord.determine_activists_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="培养人" span={1}>
                  {getFieldDecorator('train_people', {
                    initialValue:this.props.editRecord?this.props.editRecord.train_people:'',
                  })(
                    <Input />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="参加培训班时间" span={1}>
                  {getFieldDecorator('join_training_course_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.join_training_course_time?
                      moment(this.props.editRecord.join_training_course_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="第一季度思想汇报时间" span={1}>
                  {getFieldDecorator('first_quarter_report_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.first_quarter_report_time?
                      moment(this.props.editRecord.first_quarter_report_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="第二季度思想汇报时间" span={1}>
                  {getFieldDecorator('secord_quarter_report_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.secord_quarter_report_time?
                      moment(this.props.editRecord.secord_quarter_report_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="第三季度思想汇报时间" span={1}>
                  {getFieldDecorator('third_quarter_report_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.third_quarter_report_time?
                      moment(this.props.editRecord.third_quarter_report_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="第四季度思想汇报时间" span={1}>
                  {getFieldDecorator('fourth_quarter_report_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.fourth_quarter_report_time?
                      moment(this.props.editRecord.fourth_quarter_report_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="半年党支部考察时间" span={1}>
                  {getFieldDecorator('half_year_investigation_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.half_year_investigation_time?
                      moment(this.props.editRecord.half_year_investigation_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              (this.props.editRecord && this.props.editRecord.type ===2) &&
              <Fragment>
                <Descriptions.Item label="确定发展对象时间" span={1}>
                  {getFieldDecorator('determine_development_target_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.determine_development_target_time?
                      moment(this.props.editRecord.determine_development_target_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="入党介绍人" span={1}>
                  {getFieldDecorator('introducer', {
                    initialValue:this.props.editRecord?this.props.editRecord.introducer:'',
                  })(
                    <Input/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }

            {
              (this.props.editRecord && this.props.editRecord.type ===3) &&
              <Fragment>
                <Descriptions.Item label="支部大会通过为预备时间" span={1}>
                  {getFieldDecorator('determine_preparation_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.determine_preparation_time?
                      moment(this.props.editRecord.determine_preparation_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              (this.props.editRecord && this.props.editRecord.type ===4) &&
              <Fragment>
                <Descriptions.Item label="转为正式党员时间" span={1}>
                  {getFieldDecorator('regularization_time', {
                    initialValue:this.props.editRecord?this.props.editRecord.regularization_time?
                      moment(this.props.editRecord.regularization_time):'': '',
                  })(
                    <DatePicker  style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }



          </Descriptions>
        </Form>

      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);


